package tools.clustering.isodata;

import java.io.Serializable;
import java.util.ArrayList;

import tools.utils.DoubleMatrix;

public class isodata_data implements Serializable{

	private DoubleMatrix data,distances;
	private double distanceToCentroid;
	private Integer cluster,id;
	private isodata_datum centroids;
	private ArrayList<Integer> order;
	
	public isodata_data(DoubleMatrix data, Integer cluster){
		this.data=data;
		this.cluster=cluster;
	}
	public isodata_data(DoubleMatrix data,Integer cluster,Integer id){
		this(data,cluster);
		this.id=id;
	}

	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public isodata_datum getCentroids() {
		return centroids;
	}

	public void setCentroids(isodata_datum centroids) {
		this.centroids = centroids;
	}

	public Integer getCluster() {
		return cluster;
	}

	public void setCluster(Integer cluster) {
		this.cluster = cluster;
	}

	public DoubleMatrix getData() {
		return data;
	}

	public void setData(DoubleMatrix data) {
		this.data = data;
	}

	public DoubleMatrix getDistances() {
		return distances;
	}

	public void setDistances(DoubleMatrix distances) {
		this.distances = distances;
	}

	public ArrayList<Integer> getOrder() {
		return order;
	}

	public void setOrder(ArrayList<Integer> order) {
		this.order = order;
	}

	public double getDistanceToCentroid() {
		return distanceToCentroid;
	}

	public void setDistanceToCentroid(double distanceToCentroid) {
		this.distanceToCentroid = distanceToCentroid;
	}

	public double distanceTo(DoubleMatrix b)throws Exception{
		return data.squaredEuclidianLengthFromRowTo(0,b);
	}
	public double distanceTo(isodata_data b)throws Exception{
		return data.euclidianLengthFromRowTo(0,b.getData());
	}
}
